// 封装所有请求操作
import axios from '../../index'
// import qs from 'qs'


// 售后列表
export const afterSaleListAxios = (CurrentPage, PageSize, Obj) => {
    console.log(Obj);
    return axios({
        url: '/afterSales/queryList',
        method: 'POST',
        data: {
            CurrentPage, // 页数
            PageSize, // 一页的数据总量
            a_s_annex: Obj.a_s_annex, // 
            a_s_employee: Obj.a_s_employee, // 
            a_s_goods: Obj.a_s_goods, //必需 
            a_s_id: Obj.a_s_id,
            a_s_remark: Obj.a_s_remark,
            a_s_results: Obj.a_s_results,
            a_s_state: Obj.a_s_state, // 必需
            a_s_topic: Obj.a_s_topic, // 必需
            a_s_type: Obj.a_s_type, //  必需
            contact_id: Obj.contact_id, // 必需
            disposal_time: Obj.disposal_time,
            feedback_time: Obj.feedback_time,
            disposal_time01: Obj.disposal_time01,
            feedback_time01: Obj.feedback_time01,
            // fileList: Obj         // 必需
        }
    })
}
//售后搜索
export const afterSaleSpecificAxios = (CurrentPage, PageSize, str) => {
    return axios({
        url: '/afterSales/specificQueryList',
        method: 'POST',
        data: {
            CurrentPage, // 页数
            PageSize, // 一页的数据总量
            str
        }
    })
}


// 售后新增
export const afterSaleAddAxios = (obj) => {
    return axios({
        url: '/afterSales/addForm',
        method: 'POST',
        data: {
            // a_s_id: obj.a_s_id,
            a_s_topic: obj.a_s_topic,
            a_s_state: obj.a_s_state,
            a_s_type: obj.a_s_type,
            a_s_goods: obj.a_s_goods,
            contact_id: obj.contact_id,
            feedback_time: obj.feedback_time,
            a_s_annex: obj.a_s_annex,
            a_s_remark: obj.a_s_remark,
            disposal_time: obj.disposal_time,
            a_s_results: obj.a_s_results,
            a_s_employee: obj.a_s_employee,
            customer_id: obj.customer_id,
        }
    })
}

// 售后修改
export const afterSaleReviseAxios = (obj) => {
    return axios({
        url: '/afterSales/upDate',
        method: 'POST',
        data: {
            a_s_id: obj.a_s_id,
            a_s_topic: obj.a_s_topic,
            a_s_state: obj.a_s_state,
            a_s_type: obj.a_s_type,
            a_s_goods: obj.a_s_goods,
            contact_id: obj.contact_id,
            feedback_time: obj.feedback_time,
            a_s_annex: obj.a_s_annex,
            a_s_remark: obj.a_s_remark,
            disposal_time: obj.disposal_time,
            a_s_results: obj.a_s_results,
            a_s_employee: obj.a_s_employee,
            customer_id: obj.customer_id,
        }
    })
}

// 售后删除
export const afterSaleDeleteAxios = (a_s_id) => {
    return axios({
        url: '/afterSales/del',
        method: 'POST',
        data: {
            a_s_id // 删除 id
        }
    })
}

// 员工查询接口
export const afterSaleEmpAxios = () => {
    return axios({
        url: '/afterSales/queryEmp',
        method: 'POST',
        data: {}
    })
}

//商品查询
export const getGoodsAxios = (customer_id) => {
    return axios({
        url: '/afterSales/queryGoods',
        method: 'POST',
        data: {
            customer_id
        }
    })
}


//联系人查询
export const getContactAxios = (customer_id) => {
    return axios({
        url: '/queryContact',
        method: 'POST',
        data: {

            customer_id
        }
    })
}

// 联系人添加
export const addContactAxios = (obj, customer_id) => {
    return axios({
        url: '/addContact',
        method: 'POST',
        data: {
            contact_name: obj.contact_name,
            contact_sex: obj.contact_sex,
            position: obj.position,
            contact_phone: obj.contact_phone,
            contact_wechat: obj.contact_wechat,
            contact_qq: obj.contact_qq,
            contact_email: obj.contact_email,
            contact_birthday: obj.contact_birthday,
            contact_remark: obj.contact_remark,
            customer_id
        }
    })
}

// 分类种类添加
export const addCategoryAxios = (dic_Name) => {
    return axios({
        url: '/dic/addDic',
        method: 'POST',
        data: {
            dic_Name
        }
    })
}

// 分类删除
export const addCategoryDelAxios = (dic_Name) => {
    return axios({
        url: '/dic/delDic',
        method: 'POST',
        data: {
            dic_Name
        }
    })
}

// 文件上传
// export const addCategoryDelAxios = (file) => {
//     return axios({
//         url:'/dic/delDic',
//         method: 'POST',
//         data: {
//             dic_Name
//         }
//     })
// }